<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <title>xfpolys</title>
  </head>
  <body bgcolor="#FFFFFF">
    <center>Scilab Function</center>
    <div align="right">Last update : 28/07/2004</div>
    <p>
      <b>xfpolys</b> -  fill a set of polygons</p>
    <h3>
      <font color="blue">Calling Sequence</font>
    </h3>
    <dl>
      <dd>
        <tt>xfpolys(xpols,ypols,[fill])  </tt>
      </dd>
    </dl>
    <h3>
      <font color="blue">Parameters</font>
    </h3>
    <ul>
      <li>
        <tt>
          <b>xpols,ypols</b>
        </tt>: matrices of the same size (p,n) (points of the polygons).</li>
      <li>
        <tt>
          <b>fill</b>
        </tt>: vector of size n or of size (p,n)</li>
    </ul>
    <h3>
      <font color="blue">Description</font>
    </h3>
    <p>
      <tt>
        <b>xfpolys</b>
      </tt> fills a set of polygons of the same size defined by 
      the two matrices <tt>
        <b>xpols</b>
      </tt> and <tt>
        <b>ypols</b>
      </tt>. 
      The coordinates of each polygon
      are stored in a column of <tt>
        <b>xpols</b>
      </tt> and <tt>
        <b>ypols</b>
      </tt>.
    </p>
    <p>The polygons may be filled with a given color (flat) or painted with
      interpolated (shaded) colors.
    </p>
    <dl>
      <dd>
        <b>flat color painting</b>In this case <tt>
          <b>fill</b>
        </tt> should be a vector of size
	  <tt>
          <b>n</b>
        </tt>.
	  The pattern for filling polygon number i is given by
	  <tt>
          <b>fill(i)</b>
        </tt>:<dl>
          <dd>
            <b>-</b>if <tt>
              <b>fill(i)&lt;0</b>
            </tt>, the polygon is filled with
	      pattern id <tt>
              <b>-fill(i)</b>
            </tt>.</dd>
          <dd>
            <b>-</b>if <tt>
              <b>fill(i)=0</b>
            </tt>, the polygon is drawn with the
	      current dash style (or current color) and not filled.</dd>
          <dd>
            <b>-</b>if <tt>
              <b>fill(i)&gt;0</b>
            </tt>, the polygon is filled with
	      pattern id <tt>
              <b>fill(i)</b>
            </tt>.  Then its contour is drawn with
	      the current dash (or color) and closed if necessary.</dd>
        </dl>
      </dd>
      <dd>
        <b>interpolated color painting</b>
        <p>
	  In this case <tt>
            <b>fill</b>
          </tt> should be a matrix with same sizes
	  as <tt>
            <b>xpols</b>
          </tt> and <tt>
            <b>ypols</b>
          </tt>. Note that
	  <tt>
            <b>p</b>
          </tt> must be equal to 3 or 4.
	</p>
        <p>
          <tt>
            <b>fill(k,i)</b>
          </tt> gives the color at the <tt>
            <b>k</b>
          </tt>th edge
	  of polygon <tt>
            <b>i</b>
          </tt>.
	</p>
      </dd>
    </dl>
    <h3>
      <font color="blue">Examples</font>
    </h3>
    <pre>
    
    set('figure_style','new')
    a=gca();a.data_bounds=[0,-10;210,40];a.foreground=color('red');
    x1=[0,10,20,30,20,10,0]';
    y1=[15,30,30,15,0,0,15]';
    xpols=[x1 x1 x1 x1]; xpols=xpols+[0,60,120,180].*.ones(x1);
    ypols=[y1 y1 y1 y1];
    xfpolys(xpols,ypols,[-1,0,1,2])

    // interpolated colors
    clf()
    f=gcf();
    a=gca();a.data_bounds=[0,-10;40,30];a.isoview='on';
    x1=[0,10,20,10]';
    y1=[10,0,10,20]';
    c=linspace(2,100,4)';
    xpols=[x1 x1+20 x1+10 x1+10];
    ypols=[y1 y1    y1+10 y1-10];
    cols= [c c($:-1:1) c([3 4 1 2]) c]
    f.color_map=jetcolormap(max(cols));
    xfpolys(xpols,ypols,cols)
  
    // interpolated colors
    clf()
    f=gcf();
    x11=[0;20;20;0];y11=[10;10;30;30];c11=[10;10;30;30];
    x12=x11;y12=y11+20;c12=[20;20;1;1];c12=[30;30;10;10];
    x21=[0;30;30;0]+22;y21=[20;20;30;30];c21=[20;20;30;30];
    x22=x21;y22=y21+10;c22=[30;30;20;20];
    x31=[0;40;40;0]+55;y31=[0;0;30;30];c31=[0;0;30;30];
    x32=x31;y32=y31+30;c32=[30;30;0;0];
    X=[x11 x12 x21 x22 x31 x32];Y=[y11 y12 y21 y22 y31 y32];C=([c11 c12 c21 c22  c31 c32]+1)*5;
    a=gca();a.isoview='on';
    a.data_bounds=[min(X),min(Y);max(X),max(Y)];
    f=gcf();f.color_map=graycolormap(max(C));
    xfpolys(X,Y,C)

    
  </pre>
    <h3>
      <font color="blue">See Also</font>
    </h3>
    <p>
      <a href="xfpoly.htm">
        <tt>
          <b>xfpoly</b>
        </tt>
      </a>,&nbsp;&nbsp;<a href="xpoly.htm">
        <tt>
          <b>xpoly</b>
        </tt>
      </a>,&nbsp;&nbsp;<a href="xpolys.htm">
        <tt>
          <b>xpolys</b>
        </tt>
      </a>,&nbsp;&nbsp;</p>
    <h3>
      <font color="blue">Author</font>
    </h3>
    <p>J.Ph.C.  </p>
  </body>
</html>
